#ifndef GENOMEDATABASEINTERFACE_H
#define GENOMEDATABASEINTERFACE_H

#include <QObject>
#include <QPointer>
#include <QSqlDatabase>
#include <QSqlError>
#include <QStringList>


#include "genomeelementdatapacket.h"
#include "contigdatapacket.h"

class GenomeDatabaseInterface : public QObject
{
    Q_OBJECT
public:
    explicit GenomeDatabaseInterface(QObject *parent = 0);
    explicit GenomeDatabaseInterface(QString dbName, QObject *parent = 0);

    
    //------GENOME ELEMENTS
    virtual void addGenomeElementThenDeleteIt( GenomeElementDataPacket* dataPacket );
    virtual void addGenomeElement( GenomeElementDataPacket* dataPacket );

    virtual void batchAdd( QList< QPointer<GenomeElementDataPacket> > dataPackets );
    virtual void batchAddThenDelete( QList< QPointer<GenomeElementDataPacket> > dataPackets  );

    //------CONTIGS
    virtual void addContig( QPointer< ContigDataPacket> dataPacket  );
    virtual void addContigThenDeleteIt( QPointer< ContigDataPacket> dataPacket  );

    virtual void batchAdd( QList< QPointer< ContigDataPacket> > dataPackets );
    virtual void batchAddThenDelete(QList< QPointer< ContigDataPacket> > dataPackets  );

    virtual void empty();

    virtual void beginTransaction();
    virtual void commitTransaction();

//    virtual QList< QPointer<ContigDataPacket> > getSortedByLength(bool longToShort);
    virtual void getSortedByLength( QList< QPointer<ContigDataPacket> >&, QList< QPointer<GenomeElementDataPacket> >&, bool );
    virtual void getContigsWithCluster( QString clusterId, QList< QPointer<ContigDataPacket> >&, QList< QPointer<GenomeElementDataPacket> >& );
    virtual void getStringMatches( QString searchFragment, QList< QPointer<ContigDataPacket> >&, QList< QPointer<GenomeElementDataPacket> >& );

signals:

public slots:

protected:
    QSqlDatabase db;

    virtual bool createDatabase();//create new db
    virtual bool createDatabase(QString dbName);
    
};

#endif // GENOMEDATABASEINTERFACE_H
